<?php echo $this->load->view('meta'); ?>
<link rel="stylesheet" href="<?=base_url()?>css/admin.css" type="text/css" media="screen" />
<title>xa-ncsu | admin - content</title>
<link rel="stylesheet" href="<?=base_url()?>css/impromptu.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?=base_url();?>js/jquery-impromptu.1.2.js"></script>
<script type="text/javascript" src="<?=base_url();?>js/jquery.jeditable.pack.js"></script>
<script>
	$(document).ready(function() {
		$(".editable").editable("<?=site_url();?>admin/updateContent", {
			indicator	: "saving...",
			submit		: "save",
			style		: "inherit"
		});
	});
	
	function vhconfirm(v,m)
        {
            if( v )
            {
                var f =  document.createElement("form");document.body.appendChild(f);f.method = "POST";f.action = $("#" + v ).attr( "href" );f.submit();
            } else
            {
                return false;
            }
        }
</script>
<?php echo $this->load->view('header'); ?>
<h3>Static Content</h3>
<?php if ($content->num_rows() > 0): ?>
<table>
<tr>
	<th>item</th>
	<th>value</th>
</tr>
<?php foreach ($content->result() as $row) : ?>
<tr>
	<td><?=$row->key?></td>
	<td id="<?=$row->key?>" class="editable"><?=$row->value?></td>
</tr>
<?php endforeach; ?>
</table>
<?php else: ?>
<p>No Static Content.</p>
<?php endif; ?>

<h3>BiYL Submissions</h3>
<?php if ($biyl->num_rows() > 0): ?>
<table>
<tr>
	<th>name</th>
	<th>language</th>
	<th>email</th>
	<th>phone</th>
	<th>actions</th>
</tr>
<?php foreach ($biyl->result() as $row) : ?>
<tr>
	<td><?=$row->name?></td>
	<td><?=$row->language?></td>
	<td><?=$row->email?></td>
	<td><?=$row->phone?></td>
	<td><a href="<?=site_url();?>admin/deleteBIYL/<?=$row->id?>" id="conf<?=$row->id?>" onclick="$.prompt('Delete Submission?',{callback: vhconfirm, buttons: { Yes : 'conf<?=$row->id?>', No : false}}); return false;">
			<img src="<?=base_url();?>img/icons/delete.png" alt="Delete Submission" title="Delete Submission" /></a>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php else: ?>
<p>No submissions, yet.</p>
<?php endif; ?>

<h3>Podcasts</h3>
<?php if ($podcasts->num_rows() > 0): ?>
<table>
<tr>
	<th>title</th>
	<th>description</th>
	<th>filename</th>
	<th>uploaded</th>
	<th>actions</th>
</tr>
<?php foreach ($podcasts->result() as $row) : ?>
<tr>
	<td><?=$row->title?></td>
	<td><?=$row->description?></td>
	<td><?=$row->filename?></td>
	<td><?=date( 'F j, Y - g:ia', $row->uploaded)?></td>
	<td><a href="<?=site_url();?>admin/deletePodcast/<?=$row->id?>" id="conf<?=$row->id?>" onclick="$.prompt('Delete Podcast?',{callback: vhconfirm, buttons: { Yes : 'conf<?=$row->id?>', No : false}}); return false;">
			<img src="<?=base_url();?>img/icons/delete.png" alt="Delete Podcast" title="Delete Podcast" /></a></td>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php else: ?>
<p>No podcasts, yet.</p>
<?php endif; ?>

<?=form_open_multipart('admin/uploadPodcast');?>
<fieldset>
	<legend>Upload Podcast</legend>
	<ol>
		<li><label for="filename">file</label>
		<input type="file" name="userfile" size="37" /></li>
		<li><label for="title">title</label>
		<?=form_input('title')?></li>
		<li><label for="description">description</label>
		<?=form_input('description')?></li>
		<li class="submit_button"><label for="submit"><br /></label>
		<?=form_submit('','submit') ?></li>	
	</ol>
</fieldset>
</form>
<?php echo $this->load->view('footer'); ?>